var UserData=require('UserData')

cc.Class({
    extends: cc.Component,

    properties: {
        offlineGainWindowNode:{
            default:null,
            type:cc.Node
        }
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {

    },
    popWindow(){
        if(!this.offLineGainFlag && (UserData.getCurrentMoney() || UserData.getReputation())){//只弹出一次
            let resList = UserData.state.restaurantList
            let money = 0
            for(let i=0;i<resList.length;i++){
                if(resList[i]){
                    money += parseInt(resList[i].offlineGain?resList[i].offlineGain:0)
                }
            }
            this.offlineGainWindowNode.getComponent('offLineGainWindow').popWindow(money)
            this.offLineGainFlag = true
        }
    }

    
    // update (dt) {},
});
